From 7e31226c7a62a1b88727b9e718eb11b745de16ab Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Thu, 17 Dec 2009 06:27:56 +0000 Subject: [PATCH] Support for -EAGAIN from xc_gnttab_map_grant_ref. Signed-off-by: Grzegorz Milos --- tools/libxc/xc_linux.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/libxc/xc_linux.c b/tools/libxc/xc_linux.c index de176fbb8b..0f1b78aa57 100644 --- a/tools/libxc/xc_linux.c +++ b/tools/libxc/xc_linux.c @@ -442,13 +442,19 @@ void *xc_gnttab_map_grant_ref(int xcg_handle, uint32_t domid, uint32_t ref, if ( ioctl(xcg_handle, IOCTL_GNTDEV_MAP_GRANT_REF, &map) ) return NULL; +mmap_again: addr = mmap(NULL, PAGE_SIZE, prot, MAP_SHARED, xcg_handle, map.index); if ( addr == MAP_FAILED ) { int saved_errno = errno; struct ioctl_gntdev_unmap_grant_ref unmap_grant; - /* Unmap the driver slots used to store the grant information. */ + if(saved_errno == EAGAIN) + { + usleep(1000); + goto mmap_again; + } + /* Unmap the driver slots used to store the grant information. */ perror("xc_gnttab_map_grant_ref: mmap failed"); unmap_grant.index = map.index; unmap_grant.count = 1; -- 2.30.2